<?php
/**
 * The template used for displaying page content in page.php
 *
 * @package ThemeGrill
 * @subpackage ColorMag
 * @since ColorMag 1.0
 */
?>
<div class="single-page-top-section clearfix">
   <?php 
      if( is_active_sidebar( 'colormag_single_page_content_top_section' ) ) {
         if ( !dynamic_sidebar( 'colormag_single_page_content_top_section' ) ):
         endif;
      }
   ?>
</div>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<?php do_action( 'colormag_before_post_content' ); ?>

   <?php
      $image_popup_id = get_post_thumbnail_id();
      $image_popup_url = wp_get_attachment_url( $image_popup_id );
   ?>

   <?php if ( has_post_thumbnail() ) { ?>
   <!-- 注释掉特色图片 -->
<!--       <div class="featured-image">
      <?php if (get_theme_mod('colormag_featured_image_popup', 0) == 1) { ?>
         <a href="<?php echo $image_popup_url; ?>" class="image-popup"><?php the_post_thumbnail( 'colormag-featured-image' ); ?></a>
      <?php } else { ?>
         <?php the_post_thumbnail( 'colormag-featured-image' ); ?>
      <?php } ?>
      </div> -->
   <?php } ?>

   <div class="article-content clearfix">

   <?php //if( get_post_format() ) { get_template_part( 'inc/post-formats' ); } ?>

   <?php //colormag_colored_category(); ?> 

      <header class="entry-header">
   		<h1 class="entry-title">
   			<?php the_title(); ?>
   		</h1>
   	</header>

   	<?php colormag_entry_meta(); ?>

   	<div class="entry-content clearfix">
   		<?php
   			the_content();            
            $next_html_arr = array(
               'before'=>'',
               'after'=>'',
               'echo'=>false,
               'separator'=>'|',
               'link_before'       => '<span>',
               'link_after'        => '</span>',               
               'next_or_number' => 'next', 
               'nextpagelink'     => '下一页',
               'previouspagelink' => '上一页'
            );
            $next_html = wp_link_pages($next_html_arr);
            $link_arr = explode('|', $next_html);
            // 获取上一页、下一页html
            $previous_link_html = '';
            $next_link_html = '';
            if(count($link_arr)==2){
               $previous_link_html = $link_arr[0];
               $next_link_html = $link_arr[1];
            }else if(count($link_arr)==1){
               if(strpos($link_arr[0], $next_html_arr['previouspagelink'])){
                  $previous_link_html = $link_arr[0];
               }else{
                  $next_link_html = $link_arr[0];
               }
            }
         ?>

         <div class="colormag_advertisement_above_pagination">
            <?php 
               if( is_active_sidebar( 'colormag_advertisement_above_pagination' ) ) {
                  if ( !dynamic_sidebar( 'colormag_advertisement_above_pagination' ) ):
                  endif;
               }
            ?>
         </div>
         <?php
   			wp_link_pages( array(
   				'before'            => '<div style="clear: both;"></div><div class="pagination clearfix">'.$previous_link_html,
   				'after'             => ' '.$next_link_html.'</div>',
   				'link_before'       => '<span>',
   				'link_after'        => '</span>'
   	      ) );
   		?>
   	</div>
      <!-- 百度分享 -->
      <div style="padding: 10px 0 0;float: right;height: 50px;">
         <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a></div>
         <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"1","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
      </div>  
      <!-- end百度分享 -->    
      <!-- 微博点赞 -->
      <ins style="display: block;padding: 10px;">
         <wb:like appkey="1866900936"></wb:like>
         <script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js" type="text/javascript" charset="utf-8"></script>          
      </ins>
      <!-- end微博点赞 -->      
   </div>

	<?php do_action( 'colormag_after_post_content' ); ?>
</article>
<?php 
   // 获取文章时间，如果是本月的文章则添加cnzz统计代码
   if(get_the_date('m')==date('m')):
 ?>
<div style="display: none;">
<?php $author = get_the_author_meta('user_login'); if( $author=='tuxian' ){?>
<script src="http://s11.cnzz.com/z_stat.php?id=1257596780&web_id=1257596780" language="JavaScript"></script>
<?php }else if($author=='jiangwenya'){?>
<script src="http://s4.cnzz.com/z_stat.php?id=1257593036&web_id=1257593036" language="JavaScript"></script>
<?php }else if($author=='jianglingjia'){ ?>
<script src="http://s95.cnzz.com/z_stat.php?id=1260120198&web_id=1260120198" language="JavaScript"></script>
<?php }?>
</div>
<?php  
   endif;
?>
